#include"Sphere.h"

/////////////////
//include
/////////////////
#include"DeviceContext.h"
#include"Octree.h"
/////////////////
//prottype
/////////////////

/////////////////
//const
/////////////////


Sphere::Sphere(Vector3D center,float r)
{
	this->center = center;
	this->r = r;
}
Sphere::~Sphere()
{

}
void Sphere::Draw(DeviceContext* device_context)
{


}
bool Sphere::Collision(const Vector3D& pos,float r) const
{
	if(this->r == 0|| r == 0)
		return false;
	Vector3D tmp = GetPos();
	return pow(tmp.x - pos.x,2) + pow(tmp.y - pos.y,2) + pow(tmp.z - pos.z,2) <=  pow(r+this->r,2);
}
bool Sphere::Collision(const Sphere& sphere)
{
	return Collision(sphere.GetPos(),sphere.r);
}
CollInfo Sphere::Collision(CollisionObject* coll)	 
{
	return coll->Collision(this);
}